'use strict';
exports.main = async (event, context) => {
	const baseUrl = 'https://netease-cloud-music-api-omega-dun.vercel.app'
	const actoin = '/login/cellphone'
	
	const apiUrl = baseUrl + actoin
	
	const {data} = await uniCloud.httpclient.request(apiUrl, {
		method: 'GET',
		data: {
			phone: '13137657727',
			password:'qwer1180'
		},
		contentType: 'json',
		dataType: 'json'
	})
	console.log(data);
	const { code, token } = data;
	if (code === 200) {
	    // const { OPENID } = cloud.getWXContext();
	
	    return {
	      code: 0,
	      message: 'login success.',
	      data: {
	        d_t: token,
	        // openid: OPENID
	      }
	    }
	  } else {
	    return {
	      code: -1,
	      message: 'login failed.',
	      data: {}
	    }
	  }

};
